#include "SlaveRenderer.h"
#include "Window.h"
#include "Runtime/Platform/GenericWindow.h"
namespace Alice
{
    bool SlaveCGIRenderer::Initialize()
    {
        return true;
    }
    void* SlaveCGIRenderer::GetViewportResource(const Window* inWindow)
    {
        auto iter=mWindowToViewportInfo.find(inWindow);
        if(iter!=mWindowToViewportInfo.end())
        {
            return iter->second->mCGIViewport.mPtr;
        }
        return nullptr;
    }
    void SlaveCGIRenderer::CreateViewport(Window* inWindow)
    {
        GenericWindow*genericWindow=inWindow->GetNativeWindow();
        SlaveViewportInfo*slaveViewportInfo=new SlaveViewportInfo;
        slaveViewportInfo->mCGIViewport=CGICreateViewport(genericWindow->GetOSWindowHandle(),1280,720,false,EPixelFormat::PF_B8G8R8A8);
        mWindowToViewportInfo.insert(std::pair<const Window*,SlaveViewportInfo*>(inWindow,slaveViewportInfo));
    }

}